<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }
    
    html,
    body {
      width: 100%;
      height: 100%;
    }
    
    body {
      perspective: 1000px;
      background-color: #000;
      position: relative;
    }
    /* 盒子的动画 */
    
    @keyframes level_1_box_am {
      0% {
        transform: rotate3d(1, 1, 1, 0deg);
      }
      20% {
        transform: rotate3d(1, 1, 0, 60deg);
      }
      40% {
        transform: rotate3d(1, 0, 0, 120deg);
      }
      60% {
        transform: rotate3d(0, 0, 0, 180deg);
      }
      80% {
        transform: rotate3d(0, 1, 1, 240deg);
      }
      100% {
        transform: rotate3d(0, 0, 1, 300deg);
      }
    }
    /* 每个面的动画*/
    
    @keyframes level_1_div_am {
      0% {
        background-color: rgba(255, 255, 255, 0.1);
      }
      100% {
        background-color: rgba(255, 255, 255, 0.5);
      }
    }
    /* ---------------------------------- */
    
    @keyframes level_2_box_am {
      0% {
        transform: translateZ(100px) scale3d(0.5, 0.5, 0.5) rotateZ(0deg);
      }
      100% {
        transform: translateZ(100px) scale3d(0.8, 0.8, 0.8) rotateZ(360deg);
      }
    }
    
    @keyframes level_2_div_am {
      0% {
        background-color: rgba(255, 0, 0, 0.7);
      }
      100% {
        background-color: rgba(255, 0, 0, 0.3);
      }
    }
    /* -----------------------------------------第一层盒子 */
    
    .box {
      position: absolute;
      top: 50%;
      left: 50%;
      width: 200px;
      height: 200px;
      margin-left: -100px;
      margin-top: -100px;
      transform-style: preserve-3d;
      animation: level_1_box_am 5s linear infinite alternate;
      animation: name duration timing-function delay iteration-count direction fill-mode;
      /* transition: all 0.5s; */
    }
    
    .box:hover {
      /* transform: rotateY(90deg); */
    }
    
    .box .level_1 {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: rgba(255, 255, 255, 0.1);
      line-height: 200px;
      text-align: center;
      font-size: 40px;
      color: #000;
      box-sizing: border-box;
      animation: level_1_div_am 2s linear infinite alternate;
    }
    
    .box .level_1:nth-child(1) {
      transform: rotateY(0deg) translateZ(105px);
    }
    
    .box .level_1:nth-child(2) {
      transform: rotateY(90deg) translateZ(105px);
    }
    
    .box .level_1:nth-child(3) {
      transform: rotateY(180deg) translateZ(105px);
    }
    
    .box .level_1:nth-child(4) {
      transform: rotateY(270deg) translateZ(105px);
    }
    
    .box .level_1:nth-child(5) {
      transform: rotateX(90deg) translateZ(105px);
    }
    
    .box .level_1:nth-child(6) {
      transform: rotateX(-90deg) translateZ(105px);
    }
    /* -----------------------------------------第2层盒子 */
    
    .box .level_1 {
      transform-style: preserve-3d;
    }
    
    .box .level_1 ._box {
      width: 200px;
      height: 200px;
      line-height: 200px;
      transform: translateZ(100px) scale3d(0.5, 0.5, 0.5);
      position: relative;
      transform-style: preserve-3d;
      animation: level_2_box_am 5s linear infinite alternate;
      /*  */
    }
    
    ._box .level_2 {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: rgba(255, 0, 0, 0.3);
      text-align: center;
      font-size: 40px;
      color: #000;
      animation: level_2_div_am 2s linear infinite alternate;
    }
    
    ._box .level_2:nth-child(1) {
      transform: rotateY(0deg) translateZ(105px);
    }
    
    ._box .level_2:nth-child(2) {
      transform: rotateY(90deg) translateZ(105px);
    }
    
    ._box .level_2:nth-child(3) {
      transform: rotateY(180deg) translateZ(105px);
    }
    
    ._box .level_2:nth-child(4) {
      transform: rotateY(270deg) translateZ(105px);
    }
    
    ._box .level_2:nth-child(5) {
      transform: rotateX(90deg) translateZ(105px);
    }
    
    ._box .level_2:nth-child(6) {
      transform: rotateX(-90deg) translateZ(105px);
    }
  </style>
</head>

<body>
  <div class="box">
    <div class="level_1">
      <div class="_box">
        <div class="level_2">1</div>
        <div class="level_2">2</div>
        <div class="level_2">3</div>
        <div class="level_2">4</div>
        <div class="level_2">5</div>
        <div class="level_2">6</div>
      </div>
    </div>


    <div class="level_1">

      <div class="_box">
        <div class="level_2">1</div>
        <div class="level_2">2</div>
        <div class="level_2">3</div>
        <div class="level_2">4</div>
        <div class="level_2">5</div>
        <div class="level_2">6</div>
      </div>

    </div>

    <div class="level_1">

      <div class="_box">
        <div class="level_2">1</div>
        <div class="level_2">2</div>
        <div class="level_2">3</div>
        <div class="level_2">4</div>
        <div class="level_2">5</div>
        <div class="level_2">6</div>
      </div>

    </div>

    <div class="level_1">

      <div class="_box">
        <div class="level_2">1</div>
        <div class="level_2">2</div>
        <div class="level_2">3</div>
        <div class="level_2">4</div>
        <div class="level_2">5</div>
        <div class="level_2">6</div>
      </div>

    </div>
    <div class="level_1">

      <div class="_box">
        <div class="level_2">1</div>
        <div class="level_2">2</div>
        <div class="level_2">3</div>
        <div class="level_2">4</div>
        <div class="level_2">5</div>
        <div class="level_2">6</div>
      </div>


    </div>

    <div class="level_1">

      <div class="_box">
        <div class="level_2">1</div>
        <div class="level_2">2</div>
        <div class="level_2">3</div>
        <div class="level_2">4</div>
        <div class="level_2">5</div>
        <div class="level_2">6</div>
      </div>
    </div>
  </div>


  <!-- <div class="box">
    <div class="level_2">1</div>
    <div class="level_2">2</div>
    <div class="level_2">3</div>
    <div class="level_2">4</div>
    <div class="level_2">5</div>
    <div class="level_2">6</div>
  </div> -->
</body>

</html>